/**
 * 
 * axios post请求默认提交的是JSON,如果需要提交 application/x-www-form-urlencoded =>
 * 1、引入 import queryString from 'querystring';
 * 2、参数 queryString.stringify(para)
 * [参考](https://github.com/mzabriskie/axios#using-applicationx-www-form-urlencoded-format)
 * 
 * 
 * [API地址](http://59.107.26.181:8088/swagger-ui.html#/creditor-controller)
 */

import axios from 'axios';
import queryString from 'querystring';


let api = {

    postCreditorList: '/api-product/v1/creditor/list', //债权人列表 
    // postUploadExcel: 'http://10.1.13.102:8088/creditor/uploadXlsFile', //债权人上传excel表 罗城本地
    postUploadExcel: '/api-product/v1/creditor/uploadXlsFile', //债权人上传excel表   //http://59.107.26.180/showdoc/index.php?s=/2&page_id=268
    getMatchList: '/api-product/v1/creditor/showMatchByProductById', // 查看匹配名单
    getExportExcel: '/api-product/v1/creditor/exportExl', // 导出结果

}

const postCreditorList = (param) => {
    console.log(param)
    return axios.post(api.postCreditorList, param)
}

const postUploadExcel = (param) => {
    // console.log( param)

    let config = { header: { 'Content-Type': 'multipart/form-data' } }
    return axios.post(
        api.postUploadExcel,
        param,
        config,
    )
}

const getMatchList = (id) => {
    return axios.get(
        api.getMatchList, { params: { productId: id } }
    )
}



export {
    api,
    postCreditorList,
    postUploadExcel,
    getMatchList,

}